package com.tongji.seller.command
{
	import com.tongji.seller.events.GetStoreItemsEvent;
	import com.tongji.seller.model.StoreProductModel;
	import com.tongji.seller.service.StoreProductService;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 * 
	 * @author jiarong
	 * 2011-12-6
	 *
	 */
	
	public class GetStoreItemsCommand extends Command
	{
		[Inject]
		public var event:GetStoreItemsEvent;
		
		[Inject]
		public var service:StoreProductService;
		
		[Inject]
		public var model:StoreProductModel;
		
		public function GetStoreItemsCommand()
		{
			super();
		}
		
		override public function execute():void
		{
			switch(event.type)
			{
				case GetStoreItemsEvent.GET_ALL_ITEMS:
					service.getAllItem(event.nick, event.sQ, event.page_no, event.page_size);
					break;
				case GetStoreItemsEvent.UPDATE_ALL_ITEMS:
					model.updateAllItem(event.product);
					break;
				default:
					break;
			}
		}
	}
}